﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace Web
{
    public partial class dbtest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string filename = System.Configuration.ConfigurationManager.ConnectionStrings["databaselog"].ConnectionString;
            Response.Write(Server.MapPath("~/log/database.txt"));
            Response.Write(filename);
            Response.Write(System.IO.File.Exists(filename));
            SqlConnection con = new SqlConnection("Data Source=119.148.161.39;Initial Catalog =chingedesign;User Id=chingedesign;Password=pablo");
            try
            {
                con.Open();
                string sql = "SELECT * FROM LinksInfo;";
                SqlCommand cmd = new SqlCommand(sql, con);
                SqlDataReader reader = cmd.ExecuteReader();
                string content = "";
                while (reader.HasRows && reader.Read()) {
                    content += reader["LinkPicURL"].ToString();
                }
                Label1.Text = "kaokao<br />"+content;
            }
            catch(Exception ex)
            {
                Label1.Text = "roro"+ex.ToString();
            }
        }
    }
}
